<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>${title}</title>
	<meta name="keywords" content="${keywords}">
	<meta name="description" content="${description}">
	 <meta name="apple-mobile-web-app-title" content="${title}" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="${Domain}common/amazeui/i/favicon.ico">
   <link rel="stylesheet" href="${Domain}common/weui/css/weui.min.css">
    <link rel="stylesheet" href="${Domain}common/amazeui/css/amazeui.min.css" />
    <link rel="stylesheet" href="${Domain}common/amazeui/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="${Domain}common/amazeui/css/app.css">
    <script src="${Domain}common/amazeui/js/jquery.min.js"></script>

</head>

<body data-type="login">
<!--[if lte IE 9 ]>
<div class="am-alert am-alert-danger ie-warning" data-am-alert>
  <button type="button" class="am-close">&times;</button>
  <div class="am-container">
        安全卫士提醒：你的浏览器太古董了，请你下载最新的浏览器，<a
    href="http://browsehappy.com/" target="_blank">速速点击换一个</a>！</div></div>
<![endif]-->
    <script src="${Domain}common/amazeui/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title"> 选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <div class="tpl-login">
            <div class="tpl-login-content">
                <div class="tpl-login-logo">
                </div>
                <form class="am-form tpl-form-line-form" method="post" action="${Domain}api/login" id="user-login">
                    <div class="am-form-group">
                        <input type="text" class="tpl-form-input" id="account" name="account" placeholder="请输入账号" required="required">

                    </div>

                    <div class="am-form-group">
                        <input type="password" class="tpl-form-input" id="password" name="password" placeholder="请输入密码" required="required">
                    </div>
                     <div class="am-form-group"  id="main-show" style="display:none;">
	                    <select name="main" id="main" >
						
						</select>
					 </div>
                    
                    <div class="am-form-group tpl-login-remember-me">
                        <input name="save_login" type="checkbox" value="0" checked>
                        <label for="save_login">记住登录状态
                         </label>
                    </div>

                    <div class="am-form-group">
                        <button type="submit" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success  tpl-login-btn">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
<script src="${Domain}common/amazeui/js/amazeui.min.js"></script>
<script src="${Domain}common/amazeui/js/app.js"></script>
 <script src="${Domain}common/weui/js/weui.min.js"></script>
<script type="text/javascript" src="${Domain}common/js/jquery.form.min.js"></script> 
<script type="text/javascript">
 var loading ;
 	$('#user-login').bind('form-pre-serialize', function(event,form,options,veto){
 	  var main= $("#main").val();
 	   if(!main){
		var account=$("#account").val();
		    $.ajax({
			   type: "POST",
			   dataType:"json",
			   async: false,
			   url: "${Domain}api/login/main",
			   data: "account="+ account,
			   success: function(json){
			   if(json.status)
		    	{
		    	    
		    		if(json.list.length==1)  
		    		{		    		      
		    		    $.each(json.list, function(i,item){		
					    	$("#main").append("<option value='"+item.id+"' selected='selected'>"+item.name+"</option>");
					    });
					
		    		}else
		    		{
		    			$("#main-show").show();
		    		     $("#main").append("<option >请选择登录平台</option>");
		    		    $.each(json.list, function(i,item){		
					    	$("#main").append("<option value='"+item.id+"'>"+item.name+"</option>");
					    });
					    $('#main').focus();
					    weui.alert('请选择登录平台');
		    		}			
		    	}else
		    	{	    		
	               weui.alert(json.msg);
		    	}
			    
			   }
			});
		}
	});
 
	$('#user-login').ajaxForm({
	    beforeSubmit: function(a,f,o) {
	    	var main=$("#main").val();
	        if(!main)return false;//停止返回	 
	        loading =weui.loading('数据加载中...');  
	    },
	    success: function(json) {
	    	
	    	if(json.status)
	    	{
	    	   if(loading) loading.hide();
	    	    weui.toast("登录成功！"); 
	    	    <#if ask.url??>
	    		location.href="${ask.getUrl()}";	    
	    		<#else>	    	
	    		location.href="${Domain}web";	  	
	    		</#if>	
	    	}else
	    	{	    		
               if(loading) loading.hide();
	    		weui.alert(json.msg); 
	    	}
	    }
	});
</script>
</body>

</html>